package com.woniu.adminservice.service.impl;

import com.woniu.adminservice.dto.AdminDTO;
import com.woniu.adminservice.entity.Account;
import com.woniu.adminservice.dao.AccountDao;
import com.woniu.adminservice.service.AccountService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service("accountService")
public class AccountServiceImpl implements AccountService {
    @Resource
    private AccountDao accountDao;

    @Override
    public Account queryById(Integer id) {
        return accountDao.queryById(id);
    }

    @Override
    public List<Account> queryAllByLimit(int offset, int limit) {
        return accountDao.queryAllByLimit(offset, limit);
    }
   
     @Override
    public List<Account> findAll() {
        return accountDao.findAll();
    }

    @Override
    public Account insert(Account account) {
        accountDao.insert(account);
        return account;
    }

    @Override
    public Account update(Account account) {
        accountDao.update(account);
        return queryById(account.getId());
    }

    @Override
    public boolean deleteById(Integer id) {
        return accountDao.deleteById(id) > 0;
    }

    /**
     * Auther: 杨世民  <br/>
     * Date: :  <br/>
     * Description: 管理员列表
     * return:
     */
    @Override
    public List<Account> findAllByPage(Integer currentPage, Integer pageSize) {
        return accountDao.findAllByPage(currentPage,pageSize);
    }
}